1. Field of the Invention
The present invention relates to an IP (Internet protocol) fragment-processing apparatus and a method for processing the IP header of an IP packet, and a recording medium storing in it a program for performing the method.
2. Description of Related Art
An IP packet is sent together with an IP header having a checksum field of 16 bits in length in order to ensure the integrity of data.
FIG. 3 shows the format of an IP packet. The IP header is composed of the respective values of VER to DEST of FIG. 3 and has a data portion following them.
A method for calculating a checksum, which considers an IP header as a row of 16-bit words, performs addition on each word by means of ones-complement operation and further adds a carry and finally takes the ones complement of the result. This header checksum calculation is performed by built-in software of a router apparatus or the like.
In case of sending an IP packet, when the size of a packet capable of being transmitted by a network at the reception side is smaller than the size of a packet capable of being transmitted by a network at the transmission side, that IP packet is divided into a plurality of smaller packets before sending to the reception side. At this time, it is necessary to perform an IP fragmentation process for changing each value of the IP header of each smaller packet resulting from the division.
When an IP fragmentation process is performed, since the respective values of the TL (Total Length), OF (Fragment Offset), TTL (Time To Live) and HC (Header Checksum) fields are changed and the value of the FL (Flag) field can be also changed, these values need to be recalculated. Up to now, there has been a problem in that the number of steps for this recalculation increases the complexity of the associated software.
The present invention has been made in order to solve the above-mentioned problem, and aims at making it possible to process with one software instruction the checksum recalculation process of an IP header to be performed in an IP fragmentation process.
In order to attain the above-mentioned object, an IP fragment-processing apparatus according to the present invention is provided with a first register which receives a first portion of an IP header of an original IP packet, a second register which receives second portions of an IP header of a smaller packet which is obtained by dividing the original IP packet, a third register which receives third and fourth portions of the IP header of the original IP packet, a first arithmetic unit which subtracts the values of the second portions from the first portion, a second arithmetic unit which subtracts a predetermined value from the third portion and recalculates the value of the fourth portion corresponding to a change of the third portion, and a third arithmetic unit which generates a new fourth portion by adding a result of an arithmetic operation of the first arithmetic unit and the fourth portion obtained by the second arithmetic unit.
In the IP fragment-processing apparatus, the new fourth portion obtained by the third arithmetic unit may be introduced in the third register or may be introduced in a fourth register other than the third register. The IP fragment-processing method is performed by operating the above-described apparatus, and the recording medium according to the invention has stored therein computer-readable code instructing a general purpose computer to perform the method according to the invention, and to configure itself as the inventive apparatus.